1. Field of the Invention
The invention relates in general to a rotating parity redundant array of independent disk and a method for storing parity of the same, and more particularly to a rotating parity redundant array of independent disk where the address for storing parity data is changed and a method for storing parity of the same.
2. Description of the Related Art
A redundant array of independent disk (RAID) is a large capacity array constituted by many small capacity and low price disks. As many small capacity disks cost less than a large capacity disk, the redundant array of independent disk is cost saving. Then, the redundant array of independent disk divides data into several chunks and stores the chunks into respective disks of the redundant array of independent disk. Thus, data can be assessed simultaneously from respective disks, hence the accessing speed is increased. Besides, a rotating parity redundant array of independent disk contains parity data alternately stored in disks. When one of the disks is inaccessible or damaged, it is feasible to exclude the inaccessible or damaged disk and restore data according to the parity data of the remaining disks. Thus, security and reliability of data storage is enhanced.
A rotating parity redundant array of independent disk can be several levels such as a RAID 5, a RAID 6, a RAID 50, or a RAID 60.
Let a conventional rotating parity redundant array of independent disk be exemplified by a RAID 5 with accompanied drawings. FIG. 1 is a perspective of a conventional RAID 5. The conventional RAID 5 at least comprises a first disk 101, a second disk 102 and a third disk 103. The first disk 101 has an A1 block, an A2 block, . . . , and an Am block used for storing an A1 data, an A2 data, . . . , and an Am data respectively. The second disk 102 has a B1 block, a B2 block, . . . , and a Bm block used for storing a B1 data, a B2 data, . . . , and a Bm data respectively. The third disk 103 has a C1 block, a C2 block, . . . , and a Cm block used for storing a C1 data, a C2 data, . . . , and a Cm data respectively. In the RAID 5, the A1 block, the B1 block, and the C1 block correspond to each other are referred to as a first stripe (not illustrated in the diagram). Likewise, the A2 block ˜the Am block, the B2 block ˜the Bm block, and the C2 block ˜the Cm block are referred to as a second stripe ˜an mth stripe respectively.
In the conventional RAID 5, the nth parity data Pn of the nth stripe obtained from the An data and the Bn data is stored in the Cn block. The (n+1)th parity data Pn+1 of the (n+1)th stripe obtained from the An+1 data and the Cn+1 data is stored in the Bn+1 block. The (n+2)th parity data Pn+2 of the (n+2)th stripe obtained from the Bn+2 data and the Cn+2 data is stored in the An+2 block, wherein 1≦(n+2)≦m, m and n are positive integers.
Each parity data is written into the disk by generation on-the-fly. Meanwhile, parity data is calculated and written into the RAID. That is, after the An data is written into the An block and the Bn data is written into the Bn block, the RAID computes the nth parity data Pn and writes the nth parity data Pn into the Cn block at the same time. Similarly, after the Cn+1 data is written into the Cn+1 block and the An+1 data is written into the An+1 block, the RAID computes the (n+1)th parity data Pn+1 and writes it into the Bn+1 block at the same time. The nth parity data Pn can not be computed until the An data and the Bn data are written into the An block and the Bn block. Therefore, it may happen that the nth parity data Pn is obtained when the An data, the Bn data, the An+1 data and the Cn+1 data are sequentially written into the RAID. Consequently, in terms of the third disk 103, the head (not illustrated in the diagram) has to position from the Cn+1 block to the Cn block for storing the nth parity data Pn, and position to the Cn+2 block for storing the Cn+2 data after the nth parity data Pn is stored. Thus, it is necessary for the head of the third disk 103 to shift between different blocks, so the storage efficiency of the RAID is reduced. The head is a mechanical element which is subject to wear and tear if it shifts too frequently. If the head shifts too frequency, the lifespan of the disk is shortened, and the stability and efficiency of the RAID are affected.
Although it is exemplified by a RAID 5, the same problem exists in other level of rotating parity RAID. The efficiency of the RAID is decreased if the head shifts back and forth too frequently. Therefore, how to deduce the shifting time of the head of a rotating parity RAID is an essential issue to be resolved.